package com.ruoyi.system.service.impl;

import com.ruoyi.system.bean.dto.WeightUserLoginDto;
import com.ruoyi.system.domain.WeightUserConfig;
import com.ruoyi.system.mapper.WeightUserMapper;
import com.ruoyi.system.service.WeightUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WeightUserServiceImpl implements WeightUserService {

    @Autowired
    private WeightUserMapper userMapper;

    @Override
    public int inserWeightUser(WeightUserConfig config) {

//        String userName = config.getUserName();
//        if (StringUtils.isEmpty(userName)) {
//            return AjaxResult.error("用户姓名为空");
//        }
//
//        String userPassword = config.getUserPassword();
//        if (StringUtils.isEmpty(userPassword)) {
//            return AjaxResult.error("用户密码为空");
//        }

        return userMapper.inserWeightUser(config);
//        if (i == 1) {
//            return AjaxResult.success("新增成功");
//        } else{
//            return AjaxResult.error("新增失败");
//        }
    }

    @Override
    public Integer selectWeightUserByNamePassword(WeightUserLoginDto config) {
        return userMapper.selectWeightUserByNamePassword(config);
    }

    @Override
    public int selectWeightUserByName(WeightUserConfig config) {
        return userMapper.selectWeightUserByName(config);
    }
}
